package com.thiswhyme.openfeign.server.api.dto;

import lombok.AllArgsConstructor;

/**
 * Created by thiswhyme on 2020/8/16.
 */
@AllArgsConstructor
public enum Status implements IBaseEnum {

    EFFECTED(0, "可用"),
    LOCKESD(1, "锁定");

    private Integer value;
    private String desc;

    public Integer getValue() {
        return value;
    }

    public Status setValue(Integer value) {
        this.value = value;
        return this;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    public Status setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static Status indexOf(int value) {
        for (Status item : Status.values()) {
            if (item.value == value) {
                return item;
            }
        }

        return null;
    }

    public static Status nameOf(String name) {
        for (Status item : Status.values()) {
            if (item.toString().equals(name)) {
                return item;
            }
        }
        return null;
    }
}
